import 'dart:math';

import 'package:flutter/material.dart';

import 'demo/myRefresh.dart';

void main() {
  runApp(MyApp());
}

//
class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MaterialApp(
        home: MyHomePage(),
      ),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  var currentStepIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('我是标题'),
      ),
      body: MyRefresh(
        onRefresh: () async {
          print('1');
        },
        child: ListView.builder(
            itemCount: 30,
            itemBuilder: (context, index) {
              return Container(
                child: Text(''),
                width: double.infinity,
                height: 90,
                color: Color.fromARGB(
                  255,
                  Random.secure().nextInt(200),
                  Random.secure().nextInt(200),
                  Random.secure().nextInt(200),
                ),
              );
            }),
      ),
    );
  }
}
